//
//  XYHomeTableViewController.swift
//  01.XinLangWB
//
//  Created by xiaoyudong on 16/4/6.
//  Copyright © 2016年 苏小样. All rights reserved.
//

import UIKit
import SVProgressHUD
class XYHomeTableViewController: XYVisitorTableViewController {
   
   
    override func viewDidLoad() {
        super.viewDidLoad()
        //设置界面
        setupUI()
        //加载数据
        loadData()
    }
    private func setupUI () {
        //设置访客视图
        visitorView?.setVisitorInfo("关注一些人,回到这里看看有什么惊喜", imageName: "visitordiscover_feed_image_smallicon",isHome: true)
               navigationItem.rightBarButtonItem = UIBarButtonItem(imageName: "navigationbar_pop", target: self, action: "push")
        navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "navigationbar_friendsearch", target: self, action: "push")
    
    }
   @objc private func push (){
        print("push")
    let temp = XYTempViewController()
    //跳转
    navigationController?.pushViewController(temp, animated: true)
    
    }
    private func loadData() {
        guard let token = XYUserAccountViewModel.shareAccountModel.userAccount?.access_token else {
            print("用户暂未登录")
            return
        }
        HMNetworkTools.sharedTools.loadHomePageDta(token) { (result, error) -> () in
            if error != nil {
                print(error)
                SVProgressHUD.showErrorWithStatus(AppErrorTip)
                return
            }
            print(result)
        }
        
    }
}
